// 菜品管理相关API
import request from '@/utils/request'
// * 获取菜品类目
export const getDishCateApi = data => request.get('/dish/cate', {params: data})

// * 新增菜品类目
export const addDishCateApi = data => request.post('/dish/cate', data)

// * 修改菜品类目
export const setDishCateApi = data => request.put('/dish/cate', data)

// * 删除菜品类目
export const delDishCateApi = id => request.delete('/dish/cate/' + id)

// * 获取菜品信息
export const getDishDataApi = data => request.get('/dish/data', {params: data})

// * 添加菜品信息
export const addDishDataApi = data => request.post('/dish/data', data)

// * 修改菜品状态
export const changeDishDataApi = (id, state) => request.put(`/dish/data/${id}/${state}`)

// * 获取菜品详情信息
export const getDishDataInfoApi = id => request.get(`/dish/data/${id}`)

// * 修改菜品信息
export const setDishDataApi = data => request.put('/dish/data', data)

// * 加入购物车
export const addShopCarApi = (userId, dish) => {
    return request.post('/dish/shopcar', dish, {
        params: {id: userId}
    });
};
// * 获取购物车信息
export const getShopCarApi = data => request.get('/dish/shopcar', {params: data})

// * 更新购物车信息
export const updateShopCarApi = data => request.put('/dish/shopcar', data)

// * 删除购物车信息
export const deleteShopCarApi = id => request.delete(`/dish/shopcar/${id}`)

// * 批量删除购物车信息
export const deleteShopCarBatchApi = params => request.delete('/dish/shopcar', {params})

// * 结算
export const payApi = data => request.post('/dish/createOrder', null, { params: data });



// * 获取订单信息
export const getOrderApi = data => request.get('/dish/order', {params: data})
